//
//  CollectionDataSource.h
//  sisitv
//
//  Created by apple on 16/9/13.
//  Copyright © 2016年 JLXXYZG. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YZGCollectionSectionItem.h"
#import "YZGCollectionCell.h"
//#import "YZGCollectionReusableView.h"
@protocol YZGCollectionDataSource <UICollectionViewDataSource>

@optional

- (YZGCollectionRowItem *)collectionView:(UICollectionView *)collectionView itemForRowAtIndexPath:(NSIndexPath *)indexPath;

/**
 根据item或者(和)section获取cellClass
 
 @param collectionView collectionView
 @param section 指定的section
 @param item item
 @return cellClass
 */
-(Class)collectionView:(UICollectionView *)collectionView cellClassAtSection:(NSInteger)section forItem:(id)item;

-(NSArray <NSString *>*)collectionView:(UICollectionView *)collectionView cellClassNameAtSection:(NSInteger )section forItem:(id)item;

-(UIView *)collectionView:(UICollectionView *)collectionView headerViewForHeaderItem:(id)headerItem;

@end

@interface YZGCollectionDataSource : NSObject<YZGCollectionDataSource>

@property (nonatomic , weak) UIViewController<YZGCollectionCellDelegate> *delegateController;

-(instancetype)initWithController:(UIViewController<YZGCollectionCellDelegate> *)viewController;

@property (nonatomic , strong) NSMutableArray *sectionItems;

/**
 添加count个sectionItem
 
 @param count sectionItem的个数
 */
- (void)addSectionItemOfCount:(NSInteger)count;

/**
 根据index返回指定的section的sectionItem
 
 @param section 第几个section
 @return 返回一个sectionItem
 */
- (YZGCollectionSectionItem *)sectionItemForSection:(NSInteger)section;

/**
 清除所有Section中的数据
 */
- (void)clearAllSectionItems;
/**
 清除dataSource中的所有数据
 */
- (void)clearAllItems;

@end
